param(
    [string]$path = "."
)

$files = Get-ChildItem -Path $path -Include *.jpg,*.png -Recurse

foreach ($file in $files) {
    $content = [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes($file.FullName))
    $outputPath = [System.IO.Path]::ChangeExtension($file.FullName, ".txt")
    Set-Content -Path $outputPath -Value $content
}